package com.ruoyi.patrol.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.patrol.domain.vo.PtNotificationUserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.patrol.mapper.PtNotificationUserMapper;
import com.ruoyi.patrol.domain.PtNotificationUser;
import com.ruoyi.patrol.service.IPtNotificationUserService;

/**
 * 通知用户Service业务层处理
 *
 * @author 理想三旬
 * @date 2022-11-08
 */
@Service
public class PtNotificationUserServiceImpl implements IPtNotificationUserService {
    @Autowired
    private PtNotificationUserMapper ptNotificationUserMapper;

    /**
     * 查询通知用户
     *
     * @param id 通知用户ID
     * @return 通知用户
     */
    @Override
    public PtNotificationUser selectPtNotificationUserById(Long id) {
        return ptNotificationUserMapper.selectPtNotificationUserById(id);
    }

    /**
     * 查询非读条数
     *
     * @param notificationId 通知用户ID
     * @return 条数
     */
    @Override
    public int selectCancelCondition(String notificationId) {
        return ptNotificationUserMapper.selectCancelCondition(notificationId);
    }

    /**
     * 查询通知用户列表
     *
     * @param ptNotificationUser 通知用户
     * @return 通知用户
     */
    @Override
    public List<PtNotificationUser> selectPtNotificationUserList(PtNotificationUser ptNotificationUser) {
        return ptNotificationUserMapper.selectPtNotificationUserList(ptNotificationUser);
    }

    /**
     * 查询通知用户列表
     *
     * @param ptNotificationUserVo 通知用户
     * @return 通知用户
     */
    @Override
    public List<PtNotificationUserVo> selectPtNotificationUserByNotifyId(PtNotificationUserVo ptNotificationUserVo) {
        return ptNotificationUserMapper.selectPtNotificationUserByNotifyId(ptNotificationUserVo);
    }

    /**
     * 学校管理员查看通知
     *
     * @param ptNotificationUserVo 通知用户
     * @return 通知用户
     */
    @Override
    public List<PtNotificationUserVo> selectPtNotificationUserByUserId(PtNotificationUserVo ptNotificationUserVo) {
        return ptNotificationUserMapper.selectPtNotificationUserByUserId(ptNotificationUserVo);
    }

    /**
     * 学校选择pt通知用户id
     *
     * @param notificationId 通知id
     * @return {@link List}<{@link Long}>
     */
    @Override
    public List<Long> selectPtNotificationUserSchoolId(String notificationId) {
        return ptNotificationUserMapper.selectPtNotificationUserSchoolId(notificationId);
    }

    /**
     * 新增通知用户
     *
     * @param ptNotificationUser 通知用户
     * @return 结果
     */
    @Override
    public int insertPtNotificationUser(PtNotificationUser ptNotificationUser) {
        ptNotificationUser.setCreateTime(DateUtils.getNowDate());
        return ptNotificationUserMapper.insertPtNotificationUser(ptNotificationUser);
    }

    /**
     * 修改通知用户
     *
     * @param ptNotificationUser 通知用户
     * @return 结果
     */
    @Override
    public int updatePtNotificationUser(PtNotificationUser ptNotificationUser) {
        ptNotificationUser.setUpdateTime(DateUtils.getNowDate());
        return ptNotificationUserMapper.updatePtNotificationUser(ptNotificationUser);
    }

    /**
     * 批量删除通知用户
     *
     * @param ids 需要删除的通知用户ID
     * @return 结果
     */
    @Override
    public int deletePtNotificationUserByIds(Long[] ids) {
        return ptNotificationUserMapper.deletePtNotificationUserByIds(ids);
    }

    /**
     * 删除通知用户信息
     *
     * @param notificationId 通知用户ID
     * @return 结果
     */
    @Override
    public int deletePtNotificationUserById(String notificationId) {
        return ptNotificationUserMapper.deletePtNotificationUserById(notificationId);
    }
}
